/**
 * @Project Name :  aframework
 * @Package Name :  com.api.configurer
 * @Description :  TODO
 * @author :  dell
 * @Creation Date:  2017-08-10 9:40 AM
 * @ModificationHistory Who    When    What
 * --------  ---------  --------------------------
 */
package com.api.configurer;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

import java.util.Properties;

/**
 * @author :  dell
 * @Description :  TODO
 * @Creation Date:  2017-08-10 9:40 AM
 */
public class PropertyConfigurer extends PropertyPlaceholderConfigurer {

    private Properties props;

    @Override
    protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
            throws BeansException {
        super.processProperties(beanFactoryToProcess, props);
        this.props = props;
    }

    public String getProperty(String key) {
        return this.props.getProperty(key);
    }

    public String getProperty(String key, String defaultValue) {
        return this.props.getProperty(key, defaultValue);
    }

    public Object setProperty(String key, String value) {
        return this.props.setProperty(key, value);
    }
}